k = int(input())
s1 = input()
s2 = input()

sub = set()
i, j = 0, k
while j <= len(s1):
    sub.add(s1[i:j])
    i += 1
    j += 1
ans = 0
for x in sub:
    z = k
    while z <= len(s2):
        if s2[z-k : z] == x:
            ans += 1
        z += 1
print(ans)
